﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace GioHangViet.Models
{
    [Table("OrderDetail")]
    public class OrderDetail
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayOrderDetailId")]
        public int OrderId { get; set; }

        [Required(ErrorMessageResourceName = "ErrorOrderDetailProductId", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayOrderDetailProductId")]
        public int ProductId { get; set; }

        [Required(ErrorMessageResourceName = "ErrorOrderDetailPrice", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayOrderDetailPrice")]
        public decimal Price { get; set; }

        [Required(ErrorMessageResourceName = "ErrorOrderDetailProductProductName", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayOrderDetailProductName")]
        public string ProductName { get; set; }

        [DefaultValue(1)]
        [Required(ErrorMessageResourceName = "ErrorOrderDetailProductQuantity", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayOrderDetailQuantity")]
        public short Quantity { get; set; }
        
        [Required(ErrorMessageResourceName = "ErrorOrderDetailProductTotalPrice", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayOrderDetailTotalPrice")]
        public decimal TotalPrice { get; set; }
    }
}